<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改机构用户')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-smalluser-edit" th:object="${smalluser}">
        <input name="suId" th:field="${smalluser.suId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">机构用户姓名：</label>
            <div class="col-sm-8">
                <input name="suName" th:field="${smalluser.suName}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">openId：</label>
            <div class="col-sm-8">
                <input name="suOpenid" th:field="${smalluser.suOpenid}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">联系电话：</label>
            <div class="col-sm-8">
                <input name="suPhone" th:field="${smalluser.suPhone}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">所在省份：</label>
            <div class="col-sm-8">
                <select th:each="provinces : ${citys}" id="provinces" name="suProvince" onchange="provinceschange(1)">
                    <option value="">--请选择--</option>
                    <option class="pp provinces" th:value="${provinces.cId}" th:selected="${provinces.cId} == ${smalluser.suProvince}" th:text="${provinces.cName}"></option>
                </select>

            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">所在城市：</label>
            <div class="col-sm-8">
                <select th:each="provinces : ${citys}" id="city" name="suCity" onchange="citychange(1)">
                    <option value="">--请选择--</option>
                    <div  th:each="city : ${provinces.children}">
                        <option style="display: none;" class="cc provinces" th:classappend="${city.fId}" th:value="${city.cId}"  th:selected="${city.cId} == ${smalluser.suCity}" th:text="${city.cName}"></option>
                    </div>
                </select>

            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">所在旗县区：</label>
            <div class="col-sm-8">
                <select th:each="provinces : ${citys}" id="region" name="suArea">
                    <option value="">--请选择--</option>
                    <div  th:each="city : ${provinces.children}">
                        <div th:each="region : ${city.children}">
                            <option style="display: none;" class="rr provinces" th:classappend="${region.fId}" th:value="${region.cId}"  th:selected="${region.cId} == ${smalluser.suArea}" th:text="${region.cName}"></option>
                        </div>
                    </div>

                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">用户年龄：</label>
            <div class="col-sm-8">
                <input name="suAge" th:field="${smalluser.suAge}" class="form-control" type="number" required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">用户性别：</label>
            <div class="col-sm-8">
                <input name="suGender" th:field="${smalluser.suGender}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">关注时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="time" th:value="${#dates.format(smalluser.time, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=5788abd1acfdf8f29b6a3d821de26ca3"></script>
<script type="text/javascript" src="/ruoyi/js/wangEditor.js"></script>
<script th:inline="javascript">



    var prefix = ctx + "itsystem/smalluser";
    $("#form-institution-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-smalluser-edit').serialize());
        }
    }

    $("input[name='time']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });




    function provinceschange(key){
        if(key == 1) {
            var value = $("#provinces").val();
            $(".cc").hide();
            $(".rr").hide();
            $("#city").val("");
            $("#region").val("");
            $("." + value).show();
        }
    }


    function citychange(key) {
        if(key == 1) {
            var value = $("#city").val();
            $(".rr").hide();
            $("#region").val("");
            $("." + value).show();
        }
    }
</script>
</body>
<style>
    #gdmap{
        width: 470px;
        height: 200px;
    }
</style>
</html>